home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / fs / super.c.D < prev    next >
Text File  |  1990-07-25  |  7KB  |  195 lines

  1. *** /tmp/,RCSt1022253    Wed Jul 25 13:49:04 1990
  2. --- super.c    Mon Jul 23 11:34:26 1990
  3. ***************
  4. *** 15,23 ****
  5.    */
  6.   
  7. ! #include "../h/const.h"
  8. ! #include "../h/type.h"
  9. ! #include "../h/error.h"
  10. ! #include "const.h"
  11. ! #include "type.h"
  12.   #include "buf.h"
  13.   #include "inode.h"
  14. --- 15,20 ----
  15.    */
  16.   
  17. ! #include "fs.h"
  18. ! #include <minix/boot.h>
  19.   #include "buf.h"
  20.   #include "inode.h"
  21. ***************
  22. *** 31,35 ****
  23.    *===========================================================================*/
  24.   PUBLIC int load_bit_maps(dev)
  25. ! dev_nr dev;            /* which device? */
  26.   {
  27.   /* Load the bit map for some device into the cache and set up superblock. */
  28. --- 28,32 ----
  29.    *===========================================================================*/
  30.   PUBLIC int load_bit_maps(dev)
  31. ! dev_t dev;            /* which device? */
  32.   {
  33.   /* Load the bit map for some device into the cache and set up superblock. */
  34. ***************
  35. *** 38,43 ****
  36.     register struct super_block *sp;
  37.     block_nr zbase;
  38. -   extern struct buf *get_block();
  39. -   extern struct super_block *get_super();
  40.   
  41.     sp = get_super(dev);        /* get the superblock pointer */
  42. --- 35,38 ----
  43. ***************
  44. *** 59,63 ****
  45.     sp->s_imap[0]->b_int[0] |= 3;    /* inodes 0, 1 busy */
  46.     sp->s_zmap[0]->b_int[0] |= 1;    /* zone 0 busy */
  47. -   bufs_in_use += sp->s_imap_blocks + sp->s_zmap_blocks;
  48.     return(OK);
  49.   }
  50. --- 54,57 ----
  51. ***************
  52. *** 68,73 ****
  53.    *                unload_bit_maps                     *
  54.    *===========================================================================*/
  55. ! PUBLIC unload_bit_maps(dev)
  56. ! dev_nr dev;            /* which device is being unmounted? */
  57.   {
  58.   /* Unload the bit maps so a device can be unmounted. */
  59. --- 62,67 ----
  60.    *                unload_bit_maps                     *
  61.    *===========================================================================*/
  62. ! PUBLIC int unload_bit_maps(dev)
  63. ! dev_t dev;            /* which device is being unmounted? */
  64.   {
  65.   /* Unload the bit maps so a device can be unmounted. */
  66. ***************
  67. *** 78,82 ****
  68.   
  69.     sp = get_super(dev);        /* get the superblock pointer */
  70. -   bufs_in_use -= sp->s_imap_blocks + sp->s_zmap_blocks;
  71.     for (i = 0; i < sp->s_imap_blocks; i++) put_block(sp->s_imap[i], I_MAP_BLOCK);
  72.     for (i = 0; i < sp->s_zmap_blocks; i++) put_block(sp->s_zmap[i], ZMAP_BLOCK);
  73. --- 72,75 ----
  74. ***************
  75. *** 147,151 ****
  76.    *                free_bit                     *
  77.    *===========================================================================*/
  78. ! PUBLIC free_bit(map_ptr, bit_returned)
  79.   struct buf *map_ptr[];        /* pointer to array of bit block pointers */
  80.   bit_nr bit_returned;        /* number of bit to insert into the map */
  81. --- 140,144 ----
  82.    *                free_bit                     *
  83.    *===========================================================================*/
  84. ! PUBLIC void free_bit(map_ptr, bit_returned)
  85.   struct buf *map_ptr[];        /* pointer to array of bit block pointers */
  86.   bit_nr bit_returned;        /* number of bit to insert into the map */
  87. ***************
  88. *** 162,167 ****
  89.     bp = map_ptr[b];
  90.     if (bp == NIL_BUF) return;
  91. !   if (((bp->b_int[w] >> bit)& 1)== 0)
  92. !        panic("freeing unused block or inode--check file sys",(int)bit_returned);
  93.     bp->b_int[w] &= ~(1 << bit);    /* turn the bit off */
  94.     bp->b_dirt = DIRTY;
  95. --- 155,162 ----
  96.     bp = map_ptr[b];
  97.     if (bp == NIL_BUF) return;
  98. !   if (((bp->b_int[w] >> bit)& 1)== 0) {
  99. ! printf("FS freeing unused block of inode.  bit = %d\n",bit_returned); /*DEBUG*/
  100. ! /*  panic("freeing unused block or inode--check file sys",(int)bit_returned);*/
  101. !   }
  102.     bp->b_int[w] &= ~(1 << bit);    /* turn the bit off */
  103.     bp->b_dirt = DIRTY;
  104. ***************
  105. *** 173,177 ****
  106.    *===========================================================================*/
  107.   PUBLIC struct super_block *get_super(dev)
  108. ! dev_nr dev;            /* device number whose super_block is sought */
  109.   {
  110.   /* Search the superblock table for this device.  It is supposed to be there. */
  111. --- 168,172 ----
  112.    *===========================================================================*/
  113.   PUBLIC struct super_block *get_super(dev)
  114. ! dev_t dev;            /* device number whose super_block is sought */
  115.   {
  116.   /* Search the superblock table for this device.  It is supposed to be there. */
  117. ***************
  118. *** 196,202 ****
  119.   
  120.     register struct super_block *sp;
  121. !   register dev_nr dev;
  122.   
  123. !   dev = (dev_nr) rip->i_zone[0];
  124.     if (dev == ROOT_DEV) return(TRUE);    /* inode is on root file system */
  125.   
  126. --- 191,197 ----
  127.   
  128.     register struct super_block *sp;
  129. !   register dev_t dev;
  130.   
  131. !   dev = (dev_t) rip->i_zone[0];
  132.     if (dev == ROOT_DEV) return(TRUE);    /* inode is on root file system */
  133.   
  134. ***************
  135. *** 216,220 ****
  136.   /* Return the scale factor used for converting blocks to zones. */
  137.     register struct super_block *sp;
  138. -   extern struct super_block *get_super();
  139.   
  140.     sp = get_super(ip->i_dev);
  141. --- 211,214 ----
  142. ***************
  143. *** 226,230 ****
  144.    *                rw_super                     *
  145.    *===========================================================================*/
  146. ! PUBLIC rw_super(sp, rw_flag)
  147.   register struct super_block *sp; /* pointer to a superblock */
  148.   int rw_flag;             /* READING or WRITING */
  149. --- 220,224 ----
  150.    *                rw_super                     *
  151.    *===========================================================================*/
  152. ! PUBLIC void rw_super(sp, rw_flag)
  153.   register struct super_block *sp; /* pointer to a superblock */
  154.   int rw_flag;             /* READING or WRITING */
  155. ***************
  156. *** 233,238 ****
  157.   
  158.     register struct buf *bp;
  159. !   dev_nr dev;
  160. !   extern struct buf *get_block();
  161.   
  162.     /* Check if this is a read or write, and do it. */
  163. --- 227,231 ----
  164.   
  165.     register struct buf *bp;
  166. !   dev_t dev;
  167.   
  168.     /* Check if this is a read or write, and do it. */
  169. ***************
  170. *** 239,243 ****
  171.     if (rw_flag == READING) {
  172.       dev = sp->s_dev;    /* save device; it will be overwritten by copy*/
  173. !     bp = get_block(sp->s_dev, (block_nr) SUPER_BLOCK, NORMAL);
  174.       copy( (char *) sp, bp->b_data, SUPER_SIZE);
  175.       sp->s_dev = dev;    /* restore device number */
  176. --- 232,236 ----
  177.     if (rw_flag == READING) {
  178.       dev = sp->s_dev;    /* save device; it will be overwritten by copy*/
  179. !     bp = get_block(sp->s_dev, SUPER_BLOCK, NORMAL);
  180.       copy( (char *) sp, bp->b_data, SUPER_SIZE);
  181.       sp->s_dev = dev;    /* restore device number */
  182. ***************
  183. *** 244,248 ****
  184.     } else {
  185.       /* On a write, it is not necessary to go read superblock from disk. */
  186. !     bp = get_block(sp->s_dev, (block_nr) SUPER_BLOCK, NO_READ);
  187.       copy(bp->b_data, (char *) sp, SUPER_SIZE);
  188.       bp->b_dirt = DIRTY;
  189. --- 237,241 ----
  190.     } else {
  191.       /* On a write, it is not necessary to go read superblock from disk. */
  192. !     bp = get_block(sp->s_dev, SUPER_BLOCK, NO_READ);
  193.       copy(bp->b_data, (char *) sp, SUPER_SIZE);
  194.       bp->b_dirt = DIRTY;
  195.